package group.core.interceptor;

import org.apache.log4j.Logger;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * 切面类
 * @EnableAspectJAutoProxy 注解方式开启AOP切面
 */
@EnableAspectJAutoProxy
@Aspect
@Component
public class LogHandle {

    private Logger logger = Logger.getLogger(LogHandle.class);

    @Pointcut("execution(* group.base.controller.*.*(..))")
    public void addLog(){};

    @Before("addLog()")
    public void beforeLog(){
        logger.debug("执行之前做一些事情！！");
    }
}
